#pragma once

namespace my_reverse_iterator
{
	template<class Iterator, class Ref, class Rtr>
	struct Reverse_Iterator
	{

		typedef Reverse_Iterator<Iterator, Ref, Rtr> Self;

		Iterator _it;

		Reverse_Iterator(Iterator it)
			:_it(it)
		{}

		Ref operator*()
		{
			Iterator tmp = _it;
			return *(--tmp);
		}

		Rtr operator->()
		{
			return &(operator*());
		}

		Self operator++()
		{
			_it--;
			return *this;
		}

		Self operator--()
		{
			_it++;
			return *this;
		}

		bool operator!=(const Self& s) 
		{
			return _it != s._it;
		}
	};
}

